import { ipcRenderer } from "electron";

export class SystemHandle {
  private static instance: SystemHandle;

  private constructor() {}

  static getInstace() {
    return (
      SystemHandle.instance || (SystemHandle.instance = new SystemHandle())
    );
  }

  /**
   * 通过 URL 下载文件，打开文件保存窗口
   * @param url 文件地址
   * @param title 保存框标题
   */
  saveFileByUrl(url: string, title?: string) {
    ipcRenderer.send("saveFileByUrl", url, title);
  }
}
